/**
 * User路由模块
 * routes\users.js
 */
var express = require('express');
var router = express.Router();
//导入用户模块
const user = require("../controller/user");
//
const auth = require("../controller/auth");
/* GET users listing. */
router.post("/register", user.register);
router.post("/login", user.login);
router.get("/search", auth.isLogin, auth.isAdmin, user.search);
router.patch("/change-info", auth.isLogin, user.changeInfo);
router.get("/:id", auth.isLogin,auth.isSelfOfAdmin,user.find);
router.get("/",auth.isLogin,auth.isAdmin, user.findAll);
router.patch("/change-password", auth.isLogin, user.changePassword);
router.patch("/reset-password/:id", auth.isLogin, auth.isAdmin, user.resetPassword);
router.post("/",auth.isLogin,auth.isAdmin, user.add);
router.put("/:id", auth.isLogin,auth.isAdmin,user.update);
router.delete("/:id",auth.isLogin,auth.isAdmin, user.remove);
router.get("/logout",auth.isLogin, user.logout);
router.get("/count", auth.isLogin, auth.isAdmin, user.getCount);
//

module.exports = router;
